package com.scsj.supermarket.adapter;

import android.content.Context;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.scsj.supermarket.R;

import java.util.List;

/**
 * 商品详情提示栏
 */
public class GoodsRemindAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
    private Context mContext;
    private List data;

    public GoodsRemindAdapter(Context mContext, List data) {
        super(R.layout.item_goods_remind, data);
        this.mContext = mContext;
        this.data = data;
    }

    @Override
    protected void convert(BaseViewHolder helper, String item) {
        helper.setText(R.id.name_tv, item);
        ImageView iv = helper.getView(R.id.img_iv);
        if (helper.getAdapterPosition() == data.size()) {
            iv.setImageResource(R.mipmap.goods_remind_exclamation);
        } else {
            iv.setImageResource(R.mipmap.goods_remind_tick);
        }
    }
}
